//
//  ValidateUtils.m
//  playlive_sdk
//
//  Created by psvn047 on 5/16/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ValidateUtils.h"

@implementation ValidateUtils
+ (BOOL) validateEmail: (NSString *) candidate {
    NSString *emailRegex = @"[a-z0-9!#$%&'*+/=?_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"; 
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; 
    
    return [emailTest evaluateWithObject:candidate];
}
+ (BOOL) validateFullName: (NSString *) candidate {
    NSString *nameRegex = @"[a-z0-9!#$%&'*+/=?_`{|}~-]{3,16}?$"; 
    NSPredicate *nameTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", nameRegex]; 
    
    return [nameTest evaluateWithObject:candidate];
}
@end
